using System;
using System.Collections;
using System.Text;
using System.Collections.Generic;
using System.Collections.Specialized;

namespace DBRandomGenerator
{
    public  class InsertStatement
    {
        private string BeginStatement = " INSERT INTO ";
        private string _TableName = "";
        private string OpenPara  ="(";
        private string ClosePara =")";
        private string _ColumnNames ="";
        private string MiddleStatement = "Values";
        private string _ColumnValues = "";


        public override string ToString()
        {
            try
            {
                StringBuilder RDGenSB = new StringBuilder();
                if (!(Empty(TableName)) && !(Empty(ColumnNames)))/* Needs to be added later&& !(Empty(ColumnValues)*/
                {
                    RDGenSB.Append(BeginStatement);
                    RDGenSB.Append(TableName);
                    RDGenSB.Append(OpenPara);
                    RDGenSB.Append(ColumnNames);
                    RDGenSB.Append(ClosePara);
                    RDGenSB.Append(MiddleStatement);
                    RDGenSB.Append(OpenPara);
                    RDGenSB.Append(ColumnValues);
                    RDGenSB.Append(ClosePara);

                    return RDGenSB.ToString();
                }
                else
                {
                    throw new Exception("Either Table NAme or Column Names or Column Values are not populated.");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public string TableName
        {
            get { return _TableName; }
            set { _TableName = value; }
        }

        public string ColumnNames
        {
            get { return _ColumnNames; }
            set { _ColumnNames = value; }
        }

        public string ColumnValues
        {
            get { return _ColumnValues; }
            set { _ColumnValues = value; }
        }

        public bool Empty(string TestString)
        {
            return (TestString == "");
        }
    }
}
